package com.masterclient.app.modules.shop.adapter;

import android.graphics.Color;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.masterclient.app.R;
import com.masterclient.app.modules.shop.beans.StockChangeBean;

public class StockFilterAveragePopAdapter extends BaseQuickAdapter<StockChangeBean.SearchSelectBean.specBean.defaultBean,BaseViewHolder>{

    private String selectValue;

    public StockFilterAveragePopAdapter(String selectValue) {
        super(R.layout.item_stock_filter_average_pop);
        this.selectValue = selectValue;
    }

    public void updateSelectValue(String selectValue){
        this.selectValue = selectValue;
    }

    @Override
    protected void convert(BaseViewHolder helper, StockChangeBean.SearchSelectBean.specBean.defaultBean item) {
        TextView time = helper.getView(R.id.time);
        if (item.isCheck || selectValue.equals(item.value)){
            time.setBackgroundResource(R.drawable.bg_stock_change_selected);
            time.setTextColor(Color.parseColor("#FF6809"));
        }else {
            time.setBackgroundResource(R.drawable.shape_radius14_f0f2f5);
            time.setTextColor(Color.parseColor("#141922"));
        }
        time.setText(item.title);
    }
}
